<template>
    <div class="itemFormBox" :class="{'noIcon':!icon}">
        <i :class="'iconfont '+icon"></i>
        <input type="search" :placeholder="placeholder" :value="modelValue" @input="change($event)"/>
        <div class="serachBtn" @click="goSearch">搜索</div>
    </div>
</template>

<script setup>
import {ref} from 'vue'
const props = defineProps({
    modelValue:'',
    icon:{
        type:String,
        default:'icon-sousuo'
    },
    placeholder:'',
})
//const inputValue = ref('')
const emit = defineEmits(['update:modelValue','serach'])

const change = (e)=>{
    console.log("ttt:",e)
    emit('update:modelValue', e.target.value)
}
const goSearch = ()=>{
    emit('serach')
}
</script>

<style lang="scss" scoped>
    .itemFormBox{
        background: #fff;
        height: 70px;
        width: 100%;
        border-radius:35px ;
        overflow: hidden;
        display: flex;
        position: relative;
        z-index: 10;
        &.noIcon{
            i{
                width: 40px;
            }
        }
        i{
            display: flex;
            width: 80px;
            height: 100%;
            font-size: 40px;
            justify-content: center; 
            align-items: center; 
            color: #9c9c9c; 
        }
        input{
            flex: 1;
            border: 0;
            width: 100%;
            height: 100%;
            padding: 0 ;
            font-size: 28px;
            color: #333;
            background: #fff;
            &:disabled{
                background: #fafafa;
                color: #999;
            }
        }
        .serachBtn{
            height: 70px;
            width: 137px;
            text-align: center;
            line-height: 70px;
            color: #fff;
            background: #ddb851;
            font-size: 28px;
            border-radius: 35px;
        }
    }
</style>